#include"../source/server.hpp"
//业务超时测试

int main()
{
    signal(SIGCHLD,SIG_IGN);
    for(int i = 0 ; i < 10 ;i++)
    {
        pid_t pid = fork();
        if(pid < 0) 
        {
            DBG_LOG("Fork Error");
            return -1;
        }
        else if(pid == 0)
        {
            Socket cli_sock;
            bool ret = cli_sock.CreateClient(8085,"127.0.0.1");
            if(ret == false)
            {
                ERR_LOG("create newlink error");
                abort();
            }
            cout << "Create Client Success"<< endl;
            string str = "GET /hello HTTP/1.1\r\nConnection:keep-alive\r\nContent-Length:0\r\n\r\n";
            while(1)
            {
                assert(cli_sock.Send(str.c_str(),str.size())!=-1);
                char buf[1024] = {0};
                assert(cli_sock.Recv(buf,1023));
                DBG_LOG("[%s]",buf);
            }
            cli_sock.Close();
            exit(0);
        }
    }
    while(1)
    {
        sleep(1);
    }
   
}